package com.android.accessibility.ad;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ToggleButton;

public class ForwardChecker {

    private static ForwardChecker sForwardChecker = null;
    public static ForwardChecker get(Context context) {
        if (sForwardChecker == null) {
            sForwardChecker = new ForwardChecker();
        }
        sForwardChecker.mContext = context;
        return sForwardChecker;
    }

    private Context mContext;

    public void showSplash(final View layout, final OnSplashListener l) {
        Handler handler = new Handler(Looper.getMainLooper());
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (l != null) {
                    l.onSplashComplete();
                }
            }
        }, 2000);
    }

    public void init() {
    }

    public boolean allowForward() {
        return true;
    }

    public boolean hasAppWall() {
        return true;
    }

    public void spentIntegral() {
    }

    public void checkIntegral(ToggleButton button) {
    }

    public void setBannerAdView(FrameLayout layout) {
    }

    public void showTipDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setTitle("提示");
        builder.setMessage("一键转发功能已经开启，您可以去微信转发您的小视频了 !");
        builder.setPositiveButton("确定", null);
        if (hasAppWall()) {
            builder.setNegativeButton("应用推荐", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    ForwardChecker.get(mContext).showAppWall();
                }
            });
        }
        builder.create().show();
    }

    public void onDestroy() {
    }

    public void showAppWall() {
    }

    public interface OnSplashListener {
        public void onSplashComplete();
    }
}
